package domain.entities;

import javax.persistence.*;

import static javax.persistence.GenerationType.IDENTITY;

/**
 * CentroAddress entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "centro_address", catalog = "bms")
public class CentroAddress implements java.io.Serializable {

	// Fields
    private Integer id;
	private Address address;
	private TherapeuticArea therapeuticArea;
	private Centro centro;
	private String observation;
    private Specialty speciality;

    // Constructors

	/** default constructor */
	public CentroAddress() {
	}



	/** full constructor */
	public CentroAddress(Address address,
                         TherapeuticArea therapeuticArea, Centro centro, String observation) {
		this.address = address;
		this.therapeuticArea = therapeuticArea;
		this.centro = centro;
		this.observation = observation;
	}

	// Property accessors

    @Id
    @GeneratedValue(strategy = IDENTITY)
    @Column(name = "id", unique = true, nullable = false)
    public Integer getId() {
        return this.id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

	@ManyToOne(fetch = FetchType.EAGER, cascade = CascadeType.ALL)
	@JoinColumn(name = "Addressid")
	public Address getAddress() {
		return this.address;
	}

	public void setAddress(Address address) {
		this.address = address;
	}

	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "therapeuticAreaId", nullable = true)
	public TherapeuticArea getTherapeuticArea() {
		return this.therapeuticArea;
	}

	public void setTherapeuticArea(TherapeuticArea therapeuticArea) {
		this.therapeuticArea = therapeuticArea;
	}

	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "CENTROid", nullable = true)
	public Centro getCentro() {
		return this.centro;
	}

	public void setCentro(Centro centro) {
		this.centro = centro;
	}

	@Column(name = "observation")
	public String getObservation() {
		return this.observation;
	}

	public void setObservation(String observation) {
		this.observation = observation;
	}

    @OneToOne()
    public Specialty getSpeciality() {
        return speciality;
    }

    public void setSpeciality(Specialty speciality) {
        this.speciality = speciality;
    }
}